package com.bw.controller;

import com.bw.bean.Emp;
import com.bw.service.EmpService;
import com.bw.service.EmpServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping
@ResponseBody
public class EmpController {
    @Resource
    EmpServiceImpl empService;

    //正确查询数据，两表信息显示正确
    @RequestMapping("/list1")
    public List<Emp>list1(){
        List<Emp> emps = empService.list1();
        return emps;
    }
    //根据商品名模糊查询
    @RequestMapping("/list2")
    public List<Emp>list2(){
        List<Emp> emps = empService.list2("草");
        return emps;
    }
    @RequestMapping("/list3")
    public List<Emp>list3(){
        List<Emp> emps = empService.list3(100);
        return emps;
    }
    @RequestMapping("/list4")
    public List<Emp>list4(){
        List<Emp> emps = empService.list4("2000-01-01", "2023-01-25");
        return emps;
    }
    @RequestMapping("/list5")
    public int add(){
        int add = empService.add(new Emp(0, "大西梅", 2, 800, "2024-01-10", 2, "", ""));
        return add;
    }
    @RequestMapping("/list6")
    public int del(){
        int del = empService.del(11);
        return del;
    }
    @RequestMapping("/list7")
    public int upd(){
        int upd = empService.upd(1);
        return upd;
    }

}
